package org.zfes.snowier.cloud.zbss.cms.router.service.content;

import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.cloud.zbss.cms.content.model.CmsContentTag;
import org.zfes.snowier.cloud.zbss.cms.content.service.ICmsContentTagService;
@Controller("org.zfes.snowier.cloud.zbss.cms.router.service.content.CmsContentTagController") 
@RequestMapping("/cms/service/content/cmsContentTag")
public class CmsContentTagController extends BaseController {

	
	@Autowired
	private ICmsContentTagService cmsContentTagService;
	
	@RequiresPermissions(value="cmsContentTag:loadCmsContentTagDataSet",desc="内容标签列表")
    @RequestMapping(value="/loadCmsContentTagDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentTagDataSet(@RequestParam Map<String,Object> params){
	    DataSet dataSet=  cmsContentTagService.loadCmsContentTagDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	@RequiresPermissions(value="cmsContentTag:createCmsContentTag",desc="内容标签添加")
    @RequestMapping(value="/createCmsContentTag", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public  @ResponseBody Object createCmsContentTag(CmsContentTag cmsContentTag){
		cmsContentTagService.createCmsContentTag(cmsContentTag);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentTag:loadCmsContentTag",desc="内容标签加载")
    @RequestMapping(value="/loadCmsContentTag", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object loadCmsContentTag(Long id){
		Optional<CmsContentTag> ops = cmsContentTagService.loadCmsContentTagById(id);
		return ajaxQuery("cmsContentTag",ops);
    }
	
	@RequiresPermissions(value="cmsContentTag:updateCmsContentTag",desc="内容标签更新")
    @RequestMapping(value="/updateCmsContentTag", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object updateCmsContentTag(CmsContentTag cmsContentTag){
		cmsContentTagService.updateCmsContentTag(cmsContentTag);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	@RequiresPermissions(value="cmsContentTag:deletCmsContentTag",desc="内容标签删除")
    @RequestMapping(value="/deleteCmsContentTag", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public @ResponseBody  Object deleteCmsContentTag(Long id){
		cmsContentTagService.deleteCmsContentTag(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }

}